Borrowing aviation terminology, these rotations will be referred to as yaw, pitch, and roll:
A yaw is a counterclockwise rotation of \( \alpha\) about the \(z\)-axis. The rotation matrix is given by
A pitch is a counterclockwise rotation of \( \beta\) about the \( y\)-axis. The rotation matrix is given by
A roll is a counterclockwise rotation of \( \gamma\) about the \( x\)-axis. The rotation matrix is given by
Note that \( R(\alpha,\beta,\gamma)\) performs the roll first, then the pitch, and finally the yaw. If the order of these operations is changed, a different rotation matrix would result.
For gaze direction, roll does not change gaze direction, so only yaw and pitch affect gaze direction. Given a normalized 3D vector (x,y,z), how to determine the yaw and pitch angles?
The problem should be discussed based on the order of doing yaw/pitch.
Consider an eye rigid model (bound with a head rigid model), aligned with original coordinate system, is facing x positive direction. Since roll has no effect on eye direction, we only perform yaw and pitch. For coordinate transformation, we consider the reverse process.
The eye direction in new coordinate system is \(c_1 = (1,0,0)\) but \(c_2 = (x_0,y_0,z_0)\) in the original coordinate system.
If true rotation order is yaw->pitch, then . Then, \(\beta=arsin(z_0),\alpha=-artan(y_0/x_0)\).
If true rotation order is pitch->yaw, then . Then, \(\alpha=-arsin(y_0),\beta=artan(z_0/x_0)\).
If we insert \(R_x(\gamma)\) before \(c_1\), the results won’t change, which demonstrates that roll will not influence eye direction. In other words, if the true rotation order is yaw->pitch->roll or pitch->yaw->roll, the above analysis still holds.
Notice:
-
- we used right-hand coordinate system, that is, thumb along the z-axis and fingers from x-axis to y-axis.
- rotation \(\theta\) around some axis means rotating counter clockwise \(\theta\) when looking along the positive direction of that axis
- when doing rotations in sequence, each rotation is based on the up-to-date coordinate system (x-axis, y-axis, z-axis).